<template>
	<view class="container">
		<carHeader :title="'我的订单'"></carHeader>
		
		<view >
			<view class="topTabBar">
				<view class="grid" v-for="(item, tbIndex) in handlingType" :key="tbIndex" @tap="showType(tbIndex)">
					<view class="text" :class="[tbIndex == tabbarIndex ? 'active' : '']">{{ item.value }}</view>
				</view>
		
			</view>
			<view class="top">
				<view class="dropdown_container">
					<view class="t1">维修方式：</view>
					<view class="dropdown">
						<uni-data-select v-model="value" :localdata="range" @change="change" :clear="false"
							color="white"></uni-data-select>
					</view>
				</view>
		
				<view class="tanchu" @click="showPopup">
					<image src="../../static/车联网服务-08我的-03我的维修_slices/日期.png" mode=""></image>
					<text>预约日期</text>
				</view>
		
		
			</view>
		</view>



		<!-- 订单的详情 -->
		<view class="content_container">
			<view @click="goToDetail" class="content" v-for="(item, index) in orderList" :key="index">
				<view class="v1">维修单号：<text>{{ item.orderId }}</text></view>
				<view class="v2">维修方式：<text>{{ item.serviceType }}</text></view>
				<view class="v3">预约日期：<text>{{ item.appointmentDate }}</text></view>
			</view>
		</view>

		<!-- Popup内容 -->
		<view v-if="popupVisible" class="popup" :style="popupStyle">
			<view class="popup_content">
				<text class="t1">开始时间:</text>
				<view class="timestart">
					<uni-datetime-picker type="datetime" v-model="datetimesingle1" @change="changeLog1" />
				</view>

				<text class="t2">结束时间:</text>
				<view class="timeend">
					<uni-datetime-picker type="datetime" v-model="datetimesingle2" @change="changeLog2" />
				</view>
				<u-button class="btn1" type="primary" size="small" text="确定" @click="hidePopup"></u-button>

			</view>
		</view>
	</view>
</template>

<script>
	var that;
	export default {
		data() {
			return {
				popupVisible: false,
				index: 0,
				orderlist1: [{
					title: "内容1"
				}],
				orderlist2: [{
					title: "内容2"
				}],
				tabbarIndex: 0,
				handlingType: [{
						value: '进行中'
					},
					{
						value: '已完成'
					}

				],
				// 维修订单数据列表
				orderList: [{
						orderId: '3535252',
						serviceType: '上门取车',
						appointmentDate: '2024/08/12 17:11'
					},
					{
						orderId: '3535253',
						serviceType: '到店维修',
						appointmentDate: '2024/08/13 10:00'
					},
					{
						orderId: '3535254',
						serviceType: '远程指导',
						appointmentDate: '2024/08/14 15:30'
					}
				],
				value: 0,
				range: [{
						value: 0,
						text: "全部"
					},
					{
						value: 1,
						text: "到店维修"
					},
					{
						value: 2,
						text: "上门取车"
					},
				],
			};
		},
		mounted() {
			setTimeout(() => {
					this.datetimesingle1 = Date.now() - 2 * 24 * 3600 * 1000
				}, 3000),
				setTimeout(() => {
					this.datetimesingle2 = Date.now() - 2 * 24 * 3600 * 1000
				}, 3000)
		},
		methods: {
			showType(tbIndex) {
				that = this
				//跳转订单列表类型
				this.tabbarIndex = tbIndex;
				if (this.tabbarIndex == 0) {

				}
				if (this.tabbarIndex == 1) {

				}
				console.info(this.tabbarIndex)
			},
			showPopup() {
				console.log(123)
				this.popupVisible = true;
			},

			hidePopup() {
				this.popupVisible = false;
			}
		},

	};
</script>

<style lang="scss">
	

	.topTabBar {
		position: relative;
		top: -200rpx;
		left: 0;
		right: 0;
		
		height: 80rpx;
		display: flex;
		justify-content: center;
	}

	.grid {
		width: 20%;
		height: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		color: white;
		font-size: 30rpx;
	}

	.text {
		height: 76rpx;
		display: flex;
		align-items: center;
		color: white;
	}

	
	.active {
		color: white;
		border-bottom: solid 4upx white;
	}

	.top {
		
		position: relative;
		top:-150rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background-color: white;
		padding: 30rpx;
		border-radius: 20rpx;

		.dropdown_container {
			margin-right: 10rpx;
			display: flex;
			align-items: center;

			.t1 {
				margin-left: 10rpx;
				font-size: 30rpx;
			}

			.dropdown {
				
				background-color: #277af6;
				width: 160rpx;
				height: 70rpx;
				
				border-radius: 20rpx;

				.uni-select {
					border: none;

					.uni-select__input-text {
						color: #fff;

					}

					.uni-icons {
						color: #fff !important;
					}
				}
			}
		}

		.tanchu {
			
			width: 170rpx;
			height: 50rpx;
			background-color: white;

			image {
				margin-top: 15rpx;
				width: 30rpx;
				height: 30rpx;
				margin-right: 15rpx;
			}

			text {
				position: relative;
				top: -5rpx;
				font-size: 30rpx;
			}
		}




	}

	.content_container {
		position: relative;
		top:-120rpx;
		padding: 0 20rpx;

		.content {

			background-color: white;
			padding: 20rpx;
			margin-bottom: 20rpx;
			border-radius: 30rpx;
			z-index: 1;

			.v1 {
				margin-bottom: 30rpx;
				font-size: 30rpx;
			}

			.v2 {
				margin-bottom: 30rpx;
				font-size: 30rpx;
			}

			.v3 {
				font-size: 30rpx;
			}

			text {
				color: gray;
				font-size: 25rpx;
			}
		}


	}

	.popup {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		background: rgba(0, 0, 0, .4);
		
		.popup_content{
			padding: 60rpx 40rpx;
			top: 50%;
			left: 50%;
			transform: translate(-50%, -50%);
			width: 80%;
			background-color: #fff;
			position: absolute;
			border-radius: 20rpx;
			
		}
		
		
	}
</style>